import NewInfo from './NewInfo'
import * as actions from '../../redux/actions/NewInfoAction'
import * as globalActions from '../../redux/actions/GlobalAction'
import { SimpleType, StoreState } from '../../redux/Types'
import { Dispatch } from 'redux'
import { connect } from 'react-redux'


export function mapStateToProps({newInfo: { data, loading }, setting: { categorys, bands, venders } }: StoreState) {
  return {
    data,
    loading,
    categorys,
    bands,
    venders
  }
}
export function mapDispatchToProps(dispatch: Dispatch<actions.NewInfoAction | globalActions.GlobalAction>) {
  return {
    list: (data: SimpleType, page: any) => {
      dispatch(actions.page(page))
      dispatch(actions.getNewInfoList(data))
    }
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(NewInfo)